package org.cuatrovientos.EMPIRE_FLEET;

/**
 * 	Represents a generic SpaceShip
 * @author Sienar Fleet Systems
 * @greets the emperor
 */
public class SpaceShip {
	protected int type;
    private int speed;
    protected int attackRange;
    protected int energy;
    protected String pilotName;
    Position coordinates = new Position();
    /**
	 * @return the type
	 */
	 int getType() {
		return type;
	}

	/**
	 * @param type the type to set
	 */
	 void setType(int type) {
		this.type = type;
	}

	/**
	 * @return the speed
	 */
	 int getSpeed() {
		return speed;
	}

	/**
	 * @param speed the speed to set
	 */
	void setSpeed(int speed) {
		this.speed = speed;
	}

	/**
	 * @return the attackRange
	 */
	 int getAttackRange() {
		return attackRange;
	}

	/**
	 * @param attackRange the attackRange to set
	 */
	void setAttackRange(int attackRange) {
		this.attackRange = attackRange;
	}

	/**
	 * @return the energy
	 */
	int getEnergy() {
		return energy;
	}

	/**
	 * @param energy the energy to set
	 */
	void setEnergy(int energy) {
		this.energy = energy;
	}

	/**
	 * @return the pilotName
	 */
	 String getPilotName() {
		return pilotName;
	}

	/**
	 * @param pilotName the pilotName to set
	 */
	 void setPilotName(String pilotName) {
		this.pilotName = pilotName;
	}

	
	
	/**
	 * constructor
	 * @param t
	 */
	 SpaceShip (int type)  {
		this.type = type;
	}
	
	/**
	 * only tie advanced and bombers
	 * fires ION cannon
	 * @return damage
	 */
	public int fireIonCannon () {
        if (type==1 || type==2) 
                return 3;
        else 
                return 0;
}
    /**
     * "I'm firing my laser"
     * @return laser damage depending of type
     */
    public int fireLaser() {
            int damage = 0;
            switch (getType()) {
                    case 0: damage = 1;
                                    break;
                    case 1: damage = 2;
                                    break;
                    case 2: damage = 3;
                                    break;
                    default:damage = 0;
                                    break;
            }
            
            return damage;
    }

    /**
     * move, more or less depending on type
     * @return positions
     */
    public int move() {
            int movement = 0;
            switch (getType()) {
                    case 0: movement = 1;
                                    break;
                    case 1: movement = 3;
                                    break;
                    case 2: movement = 2;
                                    break;
                    default:movement = 0;
                                    break;
            }
            
            return movement;
    }
	

}
